package com.wasion.pwportable.protocol.analyzer.terminal;

import com.wasion.pwportable.protocol.analyzer.AbstractAnalyzer;

public class Terminal_Cap2CT_Analyzer extends AbstractAnalyzer {

	@Override
	public void dataAnalysis(String ackBS) {

		String dataType = ackBS.substring(DATATPYESTARTBIT, DATATPYENDBIT);

		String data = ackBS.substring(DATABITSTART, DATABITSTART + 8);

		if (dataType.equalsIgnoreCase("DE")) {
			// 电容电压
			String dataCap = data.substring(2, 4) + data.substring(0, 2);
			float capInt = Integer.parseInt(dataCap, 16) / 1000;
			result.setT_Capacitor_Volt(capInt + " mV");

			// CT 前端电压
			String ctVolt = data.substring(6, 8) + data.substring(4, 6);
			float ctVoltInt = Integer.parseInt(ctVolt, 16) / 1000;
			result.setT_CT_Volt(ctVoltInt + " mV");
		}
	}
}
